/*
 * Client.h
 *
 *  Created on: Sep 8, 2012
 *      Author: dimir
 */

#include "sys/types.h"
#include "Debug.h"
#include "Message.h"
#include "Server.h"

#ifndef CLIENT_H_
#define CLIENT_H_

class Client {

public:
	Client();
	Client(Server* server);
	int send(Message& msg);
	void registration();
	void unregistration();
	void exit();
	clients getClients();
	bool hasNewMessage();
	u_int32_t getId();
	//New message is copy and returning, then its removed.
	Message* readMessage();
	bool isRegistered();
	virtual ~Client();
	friend class Server;
private:
	bool registered;
	Server* server;
	Message* msg;
	u_int32_t id;
	static  u_int32_t all_id;
	//receive
	int recv(Message& msg);
};

#endif /* CLIENT_H_ */
